package com.bj58.ecdata.calc.dbservice.dao;

import java.util.Collections;
import java.util.Set;

import org.springframework.stereotype.Component;

import redis.clients.jedis.Tuple;

import com.bj58.ecdata.calc.dbservice.dao.model.ResumeAddModel;
import com.bj58.ecdata.exception.BusinessException;

@Component
public class ResumeAddDao extends BaseDao<ResumeAddModel>{

	public Set<Tuple> loadTopCateList(ResumeAddModel model, int count) {
		try {
			Set<Tuple> result = super.cacheLoadsDailyZset("cate2Name", model, 0, count - 1);
			if (result != null)
				return result;
			else
				return Collections.emptySet();
		} catch (Exception e) {
			throw new BusinessException(e);
		}
	}
	
	@Override
	protected String getCreateSQL() {
		 return "CREATE TABLE %s ("
			  +"`time` bigint(20) NOT NULL COMMENT '时间戳',"
			  +"`platform` varchar(50) NOT NULL COMMENT 'PC, M, APP)',"
			  +"`city1Id` int(11) NOT NULL DEFAULT 0 COMMENT '期望求职城市ID',"
			  +"`city1Name` varchar(50) NOT NULL DEFAULT '' COMMENT '期望求职城市',"
			  +"`cateId` int(11) NOT NULL DEFAULT 0 COMMENT '期望职位类别ID',"
			  +"`cate1Name` varchar(100) NOT NULL DEFAULT '' COMMENT '期望职位类别',"
			  +"`cate2Name` varchar(100) NOT NULL DEFAULT '' COMMENT '期望职位类别',"
			  +"`addNum` int(11) NOT NULL DEFAULT 0 COMMENT '新增简历数',"
			  +"KEY `time` (`time`)"
			  +") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
	}
}
